home *** CD-ROM | disk | FTP | other *** search
/ Computer Shopper 240 (DVD) / Issue 240 - February 2008 - DPCS0208DVD.ISO / Extras / NetObjects Fusion / NOF10.exe / data1.cab / FSI / lib / nof / dataobjects / tables / ecomm / TableSpace.js < prev    next >
Encoding:
JavaScript  |  2007-04-11  |  3.4 KB  |  86 lines

  1. //load all the table defs
  2. function NOF_DataObjects_Ecomm(){
  3.   this.__proto__ = NOF_DataObjects_Ecomm;
  4.   this.StoresTable   = (new NOF_DataObjects_StoresTable()).getTable();
  5.   this.CatalogsTable = (new NOF_DataObjects_CatalogsTable()).getTable();
  6.   this.env  = new Object();
  7.   
  8.   this.createTableSpace = function createTableSpace( catalogId ){    
  9.     NOF.Contract.Assert(NOF_DataObjects_Ecomm_TableSpaces["ts_" + catalogId] == null, "createTableSpace needs to be created only once");
  10.     var obj = new NOF_DataObjects_Ecomm_TableSpace();
  11.     
  12.     if (this.env.CatalogName == null || this.env.CatalogName.length <= 0){
  13.       var resultSet = this.CatalogsTable.selectById(catalogId);
  14.       this.env.CatalogName = resultSet[0][NOF.DO.ecomm.CatalogsTable.COL_NAME].value;
  15.     }
  16.     
  17.     obj.ProductsTable       = obj.ProductsTable.getTable( this.env.CatalogName, catalogId );
  18.     
  19.     obj.RelatedProductsTable= obj.RelatedProductsTable.getTable( catalogId );  
  20.     obj.OptionsTable        = obj.OptionsTable.getTable( catalogId );  
  21.     obj.OptionGroupsTable   = obj.OptionGroupsTable.getTable( catalogId );
  22.     obj.ProductOptionsTable = obj.ProductOptionsTable.getTable( catalogId );
  23.     obj.ShippingTable       = obj.ShippingTable.getTable( catalogId );
  24.     obj.TaxesTable          = obj.TaxesTable.getTable( catalogId );
  25.     obj.ManufacturersTable  = obj.ManufacturersTable.getTable( catalogId );
  26.     
  27.     NOF_DataObjects_Ecomm_TableSpaces["ts_" + catalogId] = obj;
  28.     return obj;
  29.   }
  30.   
  31.   this.getTableSpace = function getTableSpace( catalogId ){
  32.     var tsId  = "ts_" + catalogId;
  33.   
  34.     //if not loaded yet. load all tables
  35.     if (NOF_DataObjects_Ecomm_TableSpaces[tsId] == null){
  36.       NOF_DataObjects_Ecomm_TableSpaces[tsId] = this.createTableSpace(catalogId);
  37.     }
  38.     
  39.     return NOF_DataObjects_Ecomm_TableSpaces[tsId];
  40.   }
  41.   
  42.   this.getType = function getType( catalogId ){return this.CatalogsTable.TableSpaceBaseId + catalogId;};
  43.   
  44.   this.release  = function release(){
  45.     var arr = NOF_DataObjects_Ecomm_TableSpaces;
  46.     for ( var item in arr)
  47.       if ( typeof( arr[item] ) == 'object' && arr[item] != null)
  48.       {
  49.         //NOF.SysOut.info("releasing: ts" + item);      
  50.         arr[item].release();
  51.         arr[item] = null;
  52.       }
  53.       
  54.     arr  = null;
  55.     NOF_DataObjects_Ecomm_TableSpaces  = null;
  56.   };
  57. }
  58.  
  59. var NOF_DataObjects_Ecomm_TableSpaces = new Array();  
  60.   
  61. function NOF_DataObjects_Ecomm_TableSpace(){
  62.   this.ManufacturersTable   = new NOF_DataObjects_ManufacturersTable;
  63.   this.OptionGroupsTable    = new NOF_DataObjects_OptionGroupsTable;
  64.   this.OptionsTable         = new NOF_DataObjects_OptionsTable;
  65.   this.ProductOptionsTable  = new NOF_DataObjects_ProductOptionsTable;
  66.   this.ProductsTable        = new NOF_DataObjects_ProductsTable;
  67.   this.RelatedProductsTable = new NOF_DataObjects_RelatedProductsTable;
  68.   this.ShippingTable        = new NOF_DataObjects_ShippingTable;
  69.   this.TaxesTable           = new NOF_DataObjects_TaxesTable;
  70.   
  71.   this.release  = function release(){
  72.     if ( this.ProductsTable !=  null)
  73.       this.ProductsTable.clearCache(); 
  74.     
  75.     this.TaxesTable           = null;
  76.     this.OptionGroupsTable    = null;
  77.     this.OptionsTable         = null;
  78.     this.ProductOptionsTable  = null;
  79.     this.ProductsTable        = null;
  80.     this.RelatedProductsTable = null;
  81.     this.ShippingTable        = null;
  82.   };  
  83.   
  84. NOF.DO.ecomm = new NOF_DataObjects_Ecomm;
  85.